// see http://vuejs-templates.github.io/webpack for documentation.
var path = require('path')

var argv = process.argv.splice(2);

var proxy_service = '';

switch (argv[0]) {
    case 'dev':
        proxy_service = 'http://qytxl.dev.cytxl.com.cn';
        console.log('/****************** 当前连接重构环境 参数dev *******************/');
        console.log('/****************** 内网环境需配置host 10.9.20.90 qytxl.dev.cytxl.com.cn *******************/');
        break;
    case 'debug':
        proxy_service = 'http://qytxl.debug.cytxl.com.cn/';
        console.log('/****************** 当前连接debug联调环境 参数debug *******************/');
        console.log('/****************** 内网环境需配置host 120.197.233.214 qytxl.debug.cytxl.com.cn *******************/');
        break;
    case 'plus':
        proxy_service = 'http://1.qytxlng.cytxl.com.cn/';
        console.log('/****************** 当前连接plus联调环境 参数debug *******************/');
        break;
}

module.exports = {
  build: {
    env: require('./prod.env'),
    index: path.resolve(__dirname, '../dist/index.html'),
    assetsRoot: path.resolve(__dirname, '../dist'),
    assetsSubDirectory: 'static',
    assetsPublicPath: '/style/qytxl_h5/dist/',
    productionSourceMap: false,
    // Gzip off by default as many popular static hosts such as
    // Surge or Netlify already gzip all static assets for you.
    // Before setting to `true`, make sure to:
    // npm install --save-dev compression-webpack-plugin
    productionGzip: false,
    productionGzipExtensions: ['js', 'css'],
    // Run the build command with an extra argument to
    // View the bundle analyzer report after build finishes:
    // `npm run build --report`
    // Set to `true` or `false` to always turn it on or off
    bundleAnalyzerReport: process.env.npm_config_report
  },
  dev: {
    env: require('./dev.env'),
    port: 9999,
    autoOpenBrowser: true,
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {
        '/enterprise/getlist': {
            target: proxy_service,
            changeOrigin: true
        },
        '/item/index': {
            target: proxy_service,
            changeOrigin: true
        },
        '/item/get': {
            target: proxy_service,
            changeOrigin: true
        },
        '/user/index': {
            target: proxy_service,
            changeOrigin: true
        },
        '/enterprise/index': {
            target: proxy_service,
            changeOrigin: true
        },
        '/department/index': {
            target: proxy_service,
            changeOrigin: true
        },
        '/login/index': {
            target: proxy_service,
            changeOrigin: true
        },
        '/contactLevelConfig/index': {
            target: proxy_service,
            changeOrigin: true
        },

        // 重构的接口
        '/eabspecial': {
            target: proxy_service,
            changeOrigin: true
        },

        '/eabcommon': {
            target: proxy_service,
            changeOrigin: true
        },

        '/upload': {
            target: proxy_service,
            changeOrigin: true
        },

        '/eab': {
            target: proxy_service,
            changeOrigin: true
        }
    },
    // CSS Sourcemaps off by default because relative paths are "buggy"
    // with this option, according to the CSS-Loader README
    // (https://github.com/webpack/css-loader#sourcemaps)
    // In our experience, they generally work as expected,
    // just be aware of this issue when enabling this option.
    cssSourceMap: false
  }
}
